<?php

use think\admin\extend\PhinxExtend;
use think\migration\Migrator;

@set_time_limit(0);
@ini_set('memory_limit', -1);

class InstallCurd extends Migrator
{

    /**
     * 创建数据库
     */
    public function change()
    {
        $this->_create_curd_mvc();
    }

    /**
     * 创建数据对象
     * @class CurdMvc
     * @table curd_mvc
     * @return void
     */
    private function _create_curd_mvc()
    {
        // 创建数据表对象
        $table = $this->table('curd_mvc', [
            'engine' => 'InnoDB',
            'collation' => 'utf8mb4_general_ci',
            'comment' => 'CRUD-文件生成',
        ]);
        // 创建或更新数据表
        PhinxExtend::upgrade($table, [
            ['appname', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '应用名称']],
            ['modelname', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '模型名称']],
            ['controllername', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '控制器名称']],
        ], [

        ], false);
    }

}
